package com.tanhua.server.service;

import com.tanhua.dubbo.api.db.QuestionApi;
import com.tanhua.model.db.Question;
import com.tanhua.server.interceptor.UserHolder;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class QuestionService {

    @DubboReference
    private QuestionApi questionApi;

    /**
     * 保存问题
     * @param params
     */
    public void saveQuestion(Map<String, String> params) {
        String context = params.get("content");
        Question question = new Question();
        question.setTxt(context);
        question.setUserId(UserHolder.getUserId());
        questionApi.save(question);
    }
}
